﻿using AutoMapper;
using MediatR;
using SheepStorage.API.Application.Command.lishun;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.DTO.Output;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepRecordHandlers
{
    public class ShowSheepRecordCommandHandler : IRequestHandler<ShowSheepRecordCommand, Results<SheepRecord>>
    {
        ISheepRecordService _service;
        IMapper _mapper;
        public ShowSheepRecordCommandHandler(ISheepRecordService service, IMapper mapper)
        {
            _service = service;
            _mapper = mapper;
        }
        public async Task<Results<SheepRecord>> Handle(ShowSheepRecordCommand request, CancellationToken cancellationToken)
        {
            var list =await  _service.ShowSheepRecordDTO(request.ids);
            return Results<SheepRecord>.DataResult(list);
        }
    }
}
